package com.eshealthy.serviceImpl;

import com.eshealthy.dao.ManagerDao;
import com.eshealthy.entity.Department;
import com.eshealthy.entity.Doctor;
import com.eshealthy.service.ManagerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class ManagerServiceImpl implements ManagerService {
    @Autowired
    private ManagerDao managerDao;

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Doctor> findAllDoctor(Integer page, Integer rows,Integer id) {
        int start=(page-1)*rows;
        return managerDao.findAllDoctor(start,rows,id);
    }

    @Override
    public Integer findTotalsDoctor(Integer id) {
        return managerDao.findTotalsDoctor(id);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Department> findAllDepartment(Integer page, Integer rows,Integer id) {
        int start=(page-1)*rows;
        return managerDao.findAllDepartment(start,rows,id);
    }

    @Override
    public Integer findTotalsDepartment(Integer id) {
        return managerDao.findTotalsDepartment(id);
    }
}
